﻿/********************************************************************
FileName    :   Bll_OS.cs
CreateTime  :   2020-11-09 04:52:49
BaseClass   :   Bll_OS
FileType    :   .cs
Author      :  minjie
Description :   Bll_OS层（简单三层）
*********************************************************************/

using System;
using System.Text;
using System.Collections.Generic;

using System.Data;
using OS.DAL;
namespace OS.BLL
{
	/// <summary>
	/// Bll_sys_DICTIONARY的摘要说明。
	/// </summary>
    public partial class   Bll_jbxx_khdaH
  	{ 
     		      
  		private readonly Dal_jbxx_khdaH dal=new  Dal_jbxx_khdaH(); 
  		public  Bll_jbxx_khdaH() 
  		{} 
  		 
  		#region  Method 
     		      
  		public bool Exists(int DjLsh) 
  		{ 
  			return dal.Exists(DjLsh); 
  		}
        public bool Exists(string khbh)
        {
            return dal.Exists(khbh);
        }
        public bool Exists(string khbh, string sjhm, ref string bh)
        {
            return dal.Exists(khbh,   sjhm, ref   bh);
        }
        /// <summary> 
        /// 增加一条数据 
        /// </summary> 
        public bool  Add(jbxx_khdaH_Entity model,ref string error) 
  		{ 
  			return dal.Add(model,ref error); 
  		} 
   
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public  string  AddStr(jbxx_khdaH_Entity model) 
  		{ 
  			return dal.AddStr(model); 
  		} 
   
  		/// <summary> 
  		/// 更新一条数据 
  		/// </summary> 
  		public bool Update(jbxx_khdaH_Entity model) 
  		{ 
  			return dal.Update(model); 
  		} 
   
  		/// <summary> 
  		/// 更新一条数据(字符串) 
  		/// </summary> 
  		public string UpdateStr(jbxx_khdaH_Entity model) 
  		{ 
  			return dal.UpdateStr(model); 
  		} 
   
  		/// <summary> 
  		/// 删除一条数据 
  		/// </summary> 
  		public bool Delete(int DjLsh) 
  		{ 
  			 
  			return dal.Delete(DjLsh); 
  		} 
  		/// <summary> 
  		/// 批量删除一批数据 
  		/// </summary> 
  		public bool DeleteList(string lists ) 
  		{ 
  			return dal.DeleteList(lists ); 
  		} 
  		/// <summary> 
  		/// 得到一个对象实体 
  		/// </summary> 
  		public jbxx_khdaH_Entity  GetModel(int DjLsh) 
  		{ 
  			 
  			return dal.GetModel(DjLsh); 
  		}
        public jbxx_khdaH_Entity GetModel( )
        {

            return dal.GetModel();
        }

        /// <summary> 
        /// 获得数据列表 
        /// </summary> 
        public DataSet GetList(string strWhere) 
  		{ 
  			return dal.GetList(strWhere); 
  		} 
  		/// <summary> 
  		/// 获得数据count 
  		/// </summary> 
  		public int GetCount(string strWhere) 
  		{ 
  			return dal.GetRecordCount(strWhere); 
  		} 
  	 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<jbxx_khdaH_Entity> GetModelList(string strWhere) 
  		{ 
  			DataSet ds = dal.GetList(strWhere); 
  			return DataTableToList(ds.Tables[0]); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<jbxx_khdaH_Entity> GetModelList(string strWhere, string orderby, int startIndex, int endIndex) 
  		{ 
  			DataSet ds = dal.GetListByPage(strWhere, orderby, startIndex, endIndex); 
  			return DataTableToList(ds.Tables[0]); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<jbxx_khdaH_Entity> DataTableToList(DataTable dt) 
  		{ 
  			List<jbxx_khdaH_Entity> modelList = new List<jbxx_khdaH_Entity>(); 
  		  if (dt!=null ) 
  		  { 
  			int rowsCount = dt.Rows.Count; 
  			if (rowsCount > 0) 
  			{ 
  				jbxx_khdaH_Entity   model; 
  				for (int n = 0; n < rowsCount; n++) 
  				{ 
  				model = new jbxx_khdaH_Entity();					 
  			    
			      if (dt.Rows[n]["DjLsh"] != null && dt.Rows[n]["DjLsh"].ToString() != "")
                model.DjLsh = int.Parse(dt.Rows[n]["DjLsh"].ToString());
			  
	        
			      if (dt.Rows[n]["DjBtZdh"] != null && dt.Rows[n]["DjBtZdh"].ToString() != "")
                model.DjBtZdh = int.Parse(dt.Rows[n]["DjBtZdh"].ToString());
			  
	        
			      if (dt.Rows[n]["DjFtZdh"] != null && dt.Rows[n]["DjFtZdh"].ToString() != "")
                model.DjFtZdh = int.Parse(dt.Rows[n]["DjFtZdh"].ToString());
			  
	        
			      if (dt.Rows[n]["DjStZdh"] != null && dt.Rows[n]["DjStZdh"].ToString() != "")
                model.DjStZdh = int.Parse(dt.Rows[n]["DjStZdh"].ToString());
			  
	        model.DjState = dt.Rows[n]["DjState"].ToString();
	        
			      if (dt.Rows[n]["DjCount"] != null && dt.Rows[n]["DjCount"].ToString() != "")
                model.DjCount = int.Parse(dt.Rows[n]["DjCount"].ToString());
			  
	        model.bmh = dt.Rows[n]["bmh"].ToString();
	        model.bmmc = dt.Rows[n]["bmmc"].ToString();
	        model.khbh = dt.Rows[n]["khbh"].ToString();
	        model.khmc = dt.Rows[n]["khmc"].ToString();
	        model.khgm = dt.Rows[n]["khgm"].ToString();
	        model.lxr = dt.Rows[n]["lxr"].ToString();
	        model.xwy = dt.Rows[n]["xwy"].ToString();
	        model.khlx = dt.Rows[n]["khlx"].ToString();
	        model.qybh = dt.Rows[n]["qybh"].ToString();
	        model.khqy = dt.Rows[n]["khqy"].ToString();
	        model.sjqymc = dt.Rows[n]["sjqymc"].ToString();
	        model.sjqybh = dt.Rows[n]["sjqybh"].ToString();
	        if (dt.Rows[n]["khsr"] != null && dt.Rows[n]["khsr"].ToString() != "")
			  model.khsr = DateTime.Parse(dt.Rows[n]["khsr"].ToString());
			  
	        model.zkdj = dt.Rows[n]["zkdj"].ToString();
	        if (dt.Rows[n]["zk"] != null && dt.Rows[n]["zk"].ToString() != "")
			  model.zk = decimal.Parse(dt.Rows[n]["zk"].ToString());
			
	        if (dt.Rows[n]["fkzk"] != null && dt.Rows[n]["fkzk"].ToString() != "")
			  model.fkzk = decimal.Parse(dt.Rows[n]["fkzk"].ToString());
			
	        model.sjhm = dt.Rows[n]["sjhm"].ToString();
	        if (dt.Rows[n]["ljjf"] != null && dt.Rows[n]["ljjf"].ToString() != "")
			  model.ljjf = decimal.Parse(dt.Rows[n]["ljjf"].ToString());
			
	        model.dhhm = dt.Rows[n]["dhhm"].ToString();
	        model.cjhm = dt.Rows[n]["cjhm"].ToString();
	        model.dz = dt.Rows[n]["dz"].ToString();
	        model.yb = dt.Rows[n]["yb"].ToString();
	        model.dzyj = dt.Rows[n]["dzyj"].ToString();
	        model.wz = dt.Rows[n]["wz"].ToString();
	        model.khyh = dt.Rows[n]["khyh"].ToString();
	        model.zjhm = dt.Rows[n]["zjhm"].ToString();
	        model.qqhm = dt.Rows[n]["qqhm"].ToString();
	        model.hykh = dt.Rows[n]["hykh"].ToString();
	        model.mm = dt.Rows[n]["mm"].ToString();
	        model.sfgs = dt.Rows[n]["sfgs"].ToString();
	        if (dt.Rows[n]["ksye"] != null && dt.Rows[n]["ksye"].ToString() != "")
			  model.ksye = decimal.Parse(dt.Rows[n]["ksye"].ToString());
			
	        if (dt.Rows[n]["bqjf"] != null && dt.Rows[n]["bqjf"].ToString() != "")
			  model.bqjf = decimal.Parse(dt.Rows[n]["bqjf"].ToString());
			
	        if (dt.Rows[n]["ljxf"] != null && dt.Rows[n]["ljxf"].ToString() != "")
			  model.ljxf = decimal.Parse(dt.Rows[n]["ljxf"].ToString());
			
	        if (dt.Rows[n]["scbksj"] != null && dt.Rows[n]["scbksj"].ToString() != "")
			  model.scbksj = DateTime.Parse(dt.Rows[n]["scbksj"].ToString());
			  
	        model.bz = dt.Rows[n]["bz"].ToString();
	        if (dt.Rows[n]["zjycxfrq"] != null && dt.Rows[n]["zjycxfrq"].ToString() != "")
			  model.zjycxfrq = DateTime.Parse(dt.Rows[n]["zjycxfrq"].ToString());
			  
	        if (dt.Rows[n]["zjycxfje"] != null && dt.Rows[n]["zjycxfje"].ToString() != "")
			  model.zjycxfje = decimal.Parse(dt.Rows[n]["zjycxfje"].ToString());
			
	        model.zjycxfdh = dt.Rows[n]["zjycxfdh"].ToString();
	        if (dt.Rows[n]["yskje"] != null && dt.Rows[n]["yskje"].ToString() != "")
			  model.yskje = decimal.Parse(dt.Rows[n]["yskje"].ToString());
			
	        if (dt.Rows[n]["djye"] != null && dt.Rows[n]["djye"].ToString() != "")
			  model.djye = decimal.Parse(dt.Rows[n]["djye"].ToString());
			
	        model.djyh = dt.Rows[n]["djyh"].ToString();
	        if (dt.Rows[n]["djsj"] != null && dt.Rows[n]["djsj"].ToString() != "")
			  model.djsj = DateTime.Parse(dt.Rows[n]["djsj"].ToString());
			  
	        model.xgyh = dt.Rows[n]["xgyh"].ToString();
	        if (dt.Rows[n]["xgsj"] != null && dt.Rows[n]["xgsj"].ToString() != "")
			  model.xgsj = DateTime.Parse(dt.Rows[n]["xgsj"].ToString());
			  
	        model.dmmc = dt.Rows[n]["dmmc"].ToString();
	        model.sqjf = dt.Rows[n]["sqjf"].ToString();
	        
  				 modelList.Add(model); 
  				}
  			}
  		}
  			return modelList; 
  		} 
   
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetAllList() 
  		{ 
  			return GetList(""); 
  		} 
   
  		/// <summary> 
  		/// 批量处理 
  		/// </summary> 
  		public int ExecuteSqlTran(List<string> ls,ref string error ) 
  		{ 
  			return dal.ExecuteSqlTran(ls,ref   error); 
  		} 
   
  		/// <summary> 
  		/// 直接执行sql语句 
  		/// </summary> 
  		public int ExecuteSql(string sql) 
  		{ 
  			return dal.ExecuteSql(sql); 
  		} 
   
  		/// <summary> 
  		/// 直接执行sql语句 
  		/// </summary> 
  		public string GetSingle(string sql) 
  		{ 
  			return dal.GetSingle(sql); 
  		} 
   
  		/// <summary> 
  		/// 直接执行sql语句 
  		/// </summary> 
  		public DataTable ExecuteDt(string sql) 
  		{ 
  			return dal.ExecuteDt(sql); 
  		} 
   
  		/// <summary> 
  		/// 获取记录总数 
  		/// </summary> 
  		public int GetRecordCount(string strWhere) 
  		{ 
  			return  dal.GetRecordCount(strWhere); 
  		} 
  #endregion 
      
  	} 
  
}
